using System;
using System.Collections.Generic;
using System.Web.UI;
using System.Web.UI.WebControls;
using SouthernLand.Common;
using SouthernLand.Common.BOL.Articles;
using SouthernLand.Common.Untilities;

namespace SouthernLand.Controls
{
    public partial class TinTucOnline : UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Load_Menu();
        }

        private void Load_Menu()
        {
            if (!IsPostBack)
            {
                MenuCategory.Items.Clear();
                List<ArticleCategory> list =
                    ArticleCategory.GetArticleCategoryByParentID(ConvertUtility.ToInt32(EnumCategory.TinTucOnline));
                if (list != null && list.Count > 0)
                {
                    foreach (ArticleCategory c in list)
                    {
                        var newMenu = new MenuItem();
                        newMenu.Text = (Globals.LangVietNam()) ? c.CateName : c.CateName_en;
                        newMenu.Value = c.CateID.ToString();
                        newMenu.NavigateUrl = "~/Articles/Default.aspx?CateID=" + c.CateID;
                        MenuCategory.Items.Add(newMenu);
                    }
                }
            }
        }
    }
}